package com.jeesite.modules.supplier.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 供应商档案Entity
 * @author 码脑洞
 * @version 2025-04-13
 */
@Table(name="t_supplier", alias="a", label="供应商档案信息", columns={
		@Column(name="auto_id", attrName="autoId", label="主键", isPK=true),
		@Column(name="org_id", attrName="orgId", label="组织ID", isQuery=false),
		@Column(name="org_code", attrName="orgCode", label="组织编码", isQuery=false),
		@Column(name="org_name", attrName="orgName", label="组织名称", isQuery=false),
		@Column(name="supplier_code", attrName="supplierCode", label="供应商编码"),
		@Column(name="supplier_name", attrName="supplierName", label="供应商名称", queryType=QueryType.LIKE),
		@Column(name="supplier_abb_name", attrName="supplierAbbName", label="供应商简称", isQuery=false),
		@Column(name="supplier_class_id", attrName="supplierClassId", label="供应商分类", isUpdateForce=true),
		@Column(name="tel", attrName="tel", label="电话", isQuery=false),
		@Column(name="fax", attrName="fax", label="传真", isQuery=false),
		@Column(name="phone", attrName="phone", label="手机号", isQuery=false),
		@Column(name="post_code", attrName="postCode", label="邮政编码", isQuery=false),
		@Column(name="email", attrName="email", label="邮箱", isQuery=false),
		@Column(name="contacts", attrName="contacts", label="联系人", isQuery=false),
		@Column(name="address", attrName="address", label="地址", isQuery=false),
		@Column(name="source_type", attrName="sourceType", label="来源", comment="来源: 1.手工新增 2. ERP", isQuery=false),
		@Column(name="source_id", attrName="sourceId", label="来源ID", isQuery=false),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class Supplier extends DataEntity<Supplier> {
	
	private static final long serialVersionUID = 1L;
	private Long autoId;		// 主键
	private Long orgId;		// 组织ID
	private String orgCode;		// 组织编码
	private String orgName;		// 组织名称
	private String supplierCode;		// 供应商编码
	private String supplierName;		// 供应商名称
	private String supplierAbbName;		// 供应商简称
	private Long supplierClassId;		// 供应商分类
	private String tel;		// 电话
	private String fax;		// 传真
	private String phone;		// 手机号
	private String postCode;		// 邮政编码
	private String email;		// 邮箱
	private String contacts;		// 联系人
	private String address;		// 地址
	private String sourceType;		// 来源: 1.手工新增 2. ERP
	private String sourceId;		// 来源ID

	public Supplier() {
		this(null);
	}
	
	public Supplier(String id){
		super(id);
	}
	
	@JsonSerialize(using = ToStringSerializer.class)
	public Long getAutoId() {
		return autoId;
	}

	public void setAutoId(Long autoId) {
		this.autoId = autoId;
	}
	
	@NotNull(message="组织ID不能为空")
	public Long getOrgId() {
		return orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}
	
	@NotBlank(message="组织编码不能为空")
	@Size(min=0, max=10, message="组织编码长度不能超过 10 个字符")
	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	
	@NotBlank(message="组织名称不能为空")
	@Size(min=0, max=30, message="组织名称长度不能超过 30 个字符")
	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}
	
	@NotBlank(message="供应商编码不能为空")
	@Size(min=0, max=30, message="供应商编码长度不能超过 30 个字符")
	public String getSupplierCode() {
		return supplierCode;
	}

	public void setSupplierCode(String supplierCode) {
		this.supplierCode = supplierCode;
	}
	
	@NotBlank(message="供应商名称不能为空")
	@Size(min=0, max=255, message="供应商名称长度不能超过 255 个字符")
	public String getSupplierName() {
		return supplierName;
	}

	public void setSupplierName(String supplierName) {
		this.supplierName = supplierName;
	}
	
	@Size(min=0, max=255, message="供应商简称长度不能超过 255 个字符")
	public String getSupplierAbbName() {
		return supplierAbbName;
	}

	public void setSupplierAbbName(String supplierAbbName) {
		this.supplierAbbName = supplierAbbName;
	}
	
	public Long getSupplierClassId() {
		return supplierClassId;
	}

	public void setSupplierClassId(Long supplierClassId) {
		this.supplierClassId = supplierClassId;
	}
	
	@Size(min=0, max=30, message="电话长度不能超过 30 个字符")
	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}
	
	@Size(min=0, max=30, message="传真长度不能超过 30 个字符")
	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}
	
	@Size(min=0, max=30, message="手机号长度不能超过 30 个字符")
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@Size(min=0, max=30, message="邮政编码长度不能超过 30 个字符")
	public String getPostCode() {
		return postCode;
	}

	public void setPostCode(String postCode) {
		this.postCode = postCode;
	}
	
	@Size(min=0, max=30, message="邮箱长度不能超过 30 个字符")
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	
	@Size(min=0, max=125, message="联系人长度不能超过 125 个字符")
	public String getContacts() {
		return contacts;
	}

	public void setContacts(String contacts) {
		this.contacts = contacts;
	}
	
	@Size(min=0, max=500, message="地址长度不能超过 500 个字符")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	@Size(min=0, max=1, message="来源长度不能超过 1 个字符")
	public String getSourceType() {
		return sourceType;
	}

	public void setSourceType(String sourceType) {
		this.sourceType = sourceType;
	}
	
	@Size(min=0, max=64, message="来源ID长度不能超过 64 个字符")
	public String getSourceId() {
		return sourceId;
	}

	public void setSourceId(String sourceId) {
		this.sourceId = sourceId;
	}
	
}